/*
 * Copyright (C) 2015 yixun All Rights Reserved.
 * 
 * CaseMemberDto.java
 */
package com.yixun.qfbao.xf.model.dto;

import com.yixun.qfbao.xf.model.CaseMember;
import com.yixun.qfbao.xf.model.Premises;

import java.util.*;


/**
 * [文件名称]<br>
 * CaseMemberDto.java<br>
 * <br>
 * [文件描述]<br>
 * 案场人员与驻守楼盘关系表 数据辅助类<br>
 * <br>
 * [修改记录]<br>
 * 2015-11-10 14:57:23 创建 陶俊代码生成器<br>
 * 
 * @author 陶俊代码生成器
 * @version 1.00
 */
public class CaseMemberDto extends CaseMember {
	private static final long serialVersionUID = 1L;
	/**
	 *需要正序字段名
	 */
	private List<String> asc;
	/**
	 *需要逆序字段名
	 */
	private List<String> desc;
	/**
	 *排序SQL
	 */
	private String orders;
    private String piDelFlag;
    
    /**
     * 不进行分组的标识，只要有值，便相当于不分组
     */
    private String notGroupBy;
    /**
     * 是否开启到访延长限制
     */
    private Integer visitProtectSwitch;
    
    /**
     * 用户集合
     */
    private List<Long> userIds;
    
    /**
     * 楼盘集合
     */
    private List<Long> premisesIds;
    
    /**
     * 用户和楼盘关系对应的集合
     */
    private List<Map<String, Object>> userAndPremisesRels;
    
    private List<Premises> premisesList;

    /**
	 *  添加需要正序字段名
	 */
	public void addAsc(String col){
		if(asc==null){
			asc = new LinkedList<String>();
		}
		asc.add(col);
	}
	
	/**
	 *  清空需要正序字段名
	 */
	public void cleanAsc(){
		asc = null;
	}
	
	/**
	 *  添加需要逆序字段名
	 */
	public void addDesc(String col){
		if(desc==null){
			desc = new LinkedList<String>();
		}
		desc.add(col);
	}
	
	/**
	 *  清空需要逆序字段名
	 */
	public void cleanDesc(){
		desc = null;
	}
	
	/**
	 *  如果排序SQL为空根据需要正逆序的字段名拼接排序SQL
	 */
	public String  getOrders() {
		StringBuilder orderStr = null;
		StringBuilder ascStr;
		StringBuilder descStr;
		if(orders==null){
			if(asc!=null){
				ascStr = new StringBuilder();
				orderStr = new StringBuilder();
				String pex = "";
				for(String a : asc){
					ascStr.append(pex+a);
					pex = ",";
				}
				orderStr.append(ascStr.toString()+" ASC");
			}
			if(desc!=null){
				descStr = new StringBuilder();
				String pex = "";
				for(String d : desc){
					descStr.append(pex+d);
					pex = ",";
				}
				if(orderStr==null){
					orderStr = new StringBuilder();
					orderStr.append(descStr.toString()+" DESC");
				}else{
					orderStr.append(","+descStr.toString()+" DESC");
				}
			}
			orders = orderStr!=null?orderStr.toString():null;
		}
		
		return orders;
	}
	
	/**
	 *  设置排序SQL
	 */
	public void setOrders(String orders) {
		this.orders = orders;
	}
	private Date updateTimeBefore;
	private Date updateTimeAfter;
	private Date createTimeBefore;
	private Date createTimeAfter;

    public Date getUpdateTimeBefore() {
        return this.updateTimeBefore;
    }
    public void setUpdateTimeBefore(Date updateTimeBefore) {
        this.updateTimeBefore = updateTimeBefore;
    }

    public Date getUpdateTimeAfter() {
        return this.updateTimeAfter;
    }
    public void setUpdateTimeAfter(Date updateTimeAfter) {
        this.updateTimeAfter = updateTimeAfter;
    }
    public Date getCreateTimeBefore() {
        return this.createTimeBefore;
    }
    public void setCreateTimeBefore(Date createTimeBefore) {
        this.createTimeBefore = createTimeBefore;
    }

    public Date getCreateTimeAfter() {
        return this.createTimeAfter;
    }
    public void setCreateTimeAfter(Date createTimeAfter) {
        this.createTimeAfter = createTimeAfter;
    }
    
    /**
     * 经纪人状态
     */
    private String piStatus;
    /**
     * 楼盘状态
     */
    private String preStatus;
	/**
	 * 排除楼盘销售状态
	 */
    private String notSaleStatus;
    /**
     * 经纪人姓名
     */
    private String accountName;
    /**
     * 驻守人员微信openID
     */
    private String wxOpenid;
    /**
     * 楼盘名称
     */
    private String premisesName;
    /**
     * 楼盘审核状态
     */
    private String premisesStatus;
    /**
     * 结佣方式
     */
    private String commissionWay;

    /**
     * 驻守人员其他驻守楼盘
     */
    private String premisesNames;
    /**
     * 部门
     */
    private String departmentName;
    /**
     * 驻守人员角色
     */
    private String roleName;
    /**
     * 驻守人员手机号
     */
    private String phone;
	/**
	 * 到访延长时间
	 */
    private String protectTime;
	/**
	 * 最短报备时间
	 */
    private String specialTime;

    private String specialTimeType;

    private String protectTimeType;
	/**
	 * 报备保护时间
	 */
	private Long reportProtect;

    private Long reportProtectType;
    /**
     * 楼盘销售状态
     */
    private List<String> premisesSaleStatusList;

    private Set<Long> partnerIds;

	/**
	 * 报备方式
	 */
	private String reportWay;

	public String getReportWay() {
		return reportWay;
	}

	public void setReportWay(String reportWay) {
		this.reportWay = reportWay;
	}

    public List<String> getPremisesSaleStatusList() {
        return premisesSaleStatusList;
    }

    public void setPremisesSaleStatusList(List<String> premisesSaleStatusList) {
        this.premisesSaleStatusList = premisesSaleStatusList;
    }

    public String getSpecialTimeType() {
		return specialTimeType;
	}

	public void setSpecialTimeType(String specialTimeType) {
		this.specialTimeType = specialTimeType;
	}

	public Long getReportProtect() {
		return reportProtect;
	}

	public void setReportProtect(Long reportProtect) {
		this.reportProtect = reportProtect;
	}

	public Long getReportProtectType() {
		return reportProtectType;
	}

	public void setReportProtectType(Long reportProtectType) {
		this.reportProtectType = reportProtectType;
	}

	public String getCommissionWay() {
		return commissionWay;
	}

	public void setCommissionWay(String commissionWay) {
		this.commissionWay = commissionWay;
	}

	public String getPiStatus() {
		return piStatus;
	}

	public void setPiStatus(String piStatus) {
		this.piStatus = piStatus;
	}

	public String getPreStatus() {
		return preStatus;
	}

	public void setPreStatus(String preStatus) {
		this.preStatus = preStatus;
	}

	public String getAccountName() {
		return accountName;
	}

	public void setAccountName(String accountName) {
		this.accountName = accountName;
	}

	public String getPremisesStatus() {
		return premisesStatus;
	}

	public void setPremisesStatus(String premisesStatus) {
		this.premisesStatus = premisesStatus;
	}

	public String getPremisesName() {
		return premisesName;
	}

	public void setPremisesName(String premisesName) {
		this.premisesName = premisesName;
	}

	public String getPremisesNames() {
		return premisesNames;
	}

	public void setPremisesNames(String premisesNames) {
		this.premisesNames = premisesNames;
	}

	public String getDepartmentName() {
		return departmentName;
	}

	public void setDepartmentName(String departmentName) {
		this.departmentName = departmentName;
	}

	public String getRoleName() {
		return roleName;
	}

	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getProtectTime() {
		return protectTime;
	}

	public void setProtectTime(String protectTime) {
		this.protectTime = protectTime;
	}

	public String getSpecialTime() {
		return specialTime;
	}

	public void setSpecialTime(String specialTime) {
		this.specialTime = specialTime;
	}

	public String getNotSaleStatus() {
		return notSaleStatus;
	}

	public void setNotSaleStatus(String notSaleStatus) {
		this.notSaleStatus = notSaleStatus;
	}

	public String getProtectTimeType() {
		return protectTimeType;
	}

	public void setProtectTimeType(String protectTimeType) {
		this.protectTimeType = protectTimeType;
	}

    public String getWxOpenid() {
        return wxOpenid;
    }

    public void setWxOpenid(String wxOpenid) {
        this.wxOpenid = wxOpenid;
    }

    public String getPiDelFlag() {
        return piDelFlag;
    }

    public void setPiDelFlag(String piDelFlag) {
        this.piDelFlag = piDelFlag;
    }

    public Integer getVisitProtectSwitch() {
        return visitProtectSwitch;
    }

    public void setVisitProtectSwitch(Integer visitProtectSwitch) {
        this.visitProtectSwitch = visitProtectSwitch;
    }

	public Set<Long> getPartnerIds() {
		return partnerIds;
	}

	public void setPartnerIds(Set<Long> partnerIds) {
		this.partnerIds = partnerIds;
	}

	public List<Long> getUserIds() {
		return userIds;
	}

	public void setUserIds(List<Long> userIds) {
		this.userIds = userIds;
	}

	public List<Premises> getPremisesList() {
		return premisesList;
	}

	public void setPremisesList(List<Premises> premisesList) {
		this.premisesList = premisesList;
	}

	
	public List<Map<String, Object>> getUserAndPremisesRels() {
		return userAndPremisesRels == null? new ArrayList<>(): userAndPremisesRels;
	}

	public void setUserAndPremisesRels(List<Map<String, Object>> userAndPremisesRels) {
		this.userAndPremisesRels = userAndPremisesRels;
	}

	
	public void addUserAndPremisesRel(Long userId, List<Premises> premisesList) {
		if(userAndPremisesRels == null) {
			userAndPremisesRels = new ArrayList<>();
		}
		for (Premises premises : premisesList) {
			Map<String, Object> caseMemberInfo = new HashMap<>();
			caseMemberInfo.put("userId", userId);
			caseMemberInfo.put("premisesId", premises.getId());
			caseMemberInfo.put("premisesName", premises.getName());
			userAndPremisesRels.add(caseMemberInfo);
		}
		
	}
	
	/**
	 * 添加用户和楼盘的对应关系
	 * @param userId
	 * @param premisesIds
	 */
	public void addUserAndPremisesRel(Long userId, Premises premises) {
		if(userAndPremisesRels == null) {
			userAndPremisesRels = new ArrayList<>();
		}
		Map<String, Object> caseMemberInfo = new HashMap<>();
		caseMemberInfo.put("userId", userId);
		caseMemberInfo.put("premisesId", premises.getId());
		caseMemberInfo.put("premisesName", premises.getName());
		userAndPremisesRels.add(caseMemberInfo);
	}

	public List<Long> getPremisesIds() {
		return premisesIds;
	}

	public void setPremisesIds(List<Long> premisesIds) {
		this.premisesIds = premisesIds;
	}

	public String getNotGroupBy() {
		return notGroupBy;
	}

	public void setNotGroupBy(String notGroupBy) {
		this.notGroupBy = notGroupBy;
	}
}
